package server;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Chater implements Runnable{
	private Socket socket;
	private OutputStream out;
	private ObjectInputStream in;
	private String name;
	public Chater(Socket socket) {
		this.socket=socket;
		try {
			out=socket.getOutputStream();
			in=new ObjectInputStream(socket.getInputStream());
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
	private void login(){
		
	}
	public void run() {
		while(true){
			Protocol p=null;
			try {
				p = (Protocol)in.readObject();
			} catch (ClassNotFoundException e) {
				e.printStackTrace();
			} catch (IOException e) {
				System.out.println("有一个客户端连接断开");
				break;
			}
			int action=p.getAction();
			switch (action) {
			case 0:
				System.out.println("有用户登录。。。");
				break;
			default:
				break;
			}
			
		}
	}
}
